package com.kishimemo.choitethering;





import android.app.Activity;
import android.os.Bundle;
//import android.provider.Settings;
//import android.provider.Settings.SettingNotFoundException;
//import android.provider.Settings.System;
import android.util.Log;
import android.widget.CheckBox;
import android.widget.CompoundButton;

public class ChoiTetheringActivity extends Activity {

	final String TAG = "TetheringActivation";
	CheckBox chkOnOff;
	int nTethering;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
	    setContentView(R.layout.tetheringactivation);
	    chkOnOff = (CheckBox)findViewById(R.id.chkOnOff);
        

  	    chkOnOff.setText(R.string.tethering_on);
	    boolean bool1 = android.provider.Settings.System.putInt(getContentResolver(), "tethering_on", 1);
	    this.nTethering = 1;
        int j = this.nTethering;
	     String str = "isChecked : " + j;
	     int k = Log.d("TetheringActivation", str);
	     CheckBox localCheckBox1 = (CheckBox)findViewById(R.id.chkOnOff);
	     chkOnOff = localCheckBox1;
	     if (this.nTethering == 0){
	        chkOnOff.setText(R.string.tethering_off);
	        chkOnOff.setChecked(false);
	     }else{
		    chkOnOff.setText(R.string.tethering_on);
		    chkOnOff.setChecked(true);
	      }
	     CheckBox localCheckBox2 = chkOnOff;
	     localCheckBox2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
	     
	    public void onCheckedChanged(CompoundButton paramCompoundButton, boolean paramBoolean) { 
	        		String str = "isChecked : " + paramBoolean;
	        	    int i = Log.d("TetheringActivation", str);
	        	    if (paramBoolean){
	        	      chkOnOff.setText(R.string.tethering_on);
	        	      boolean bool1 = android.provider.Settings.System.putInt(getContentResolver(), "tethering_on", 1);
	        	      return;
	        	    }
	        	    chkOnOff.setText(R.string.tethering_off);
	        	    boolean bool2 = android.provider.Settings.System.putInt(getContentResolver(), "tethering_on", 0);		
	        	}
	        }
	       );
	      return;
    }
}